<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>后台-编辑资源|银光云-为银光字幕组提供最优质的云存储服务 - Powered by 金鸡独立</title>
<%!
	class UploadList{
		int id;
		int userid;
		String name;
		String datetime;
		String detail;
		boolean hidden;
		int count;
		String file;
	}
%>
<%
	UploadList ul=new UploadList();
	String user=null;
	Cookie[] cookie=request.getCookies();
	if(cookie!=null){
		for(int i=0;i<cookie.length;i++){
			if(cookie[i].getName().equals("SilverCouldUserName")==true){
				user=cookie[i].getValue();
			}
		}
	}
	if((user=="")||(user==null)){
		out.println("您还没有登陆，请进入登陆页面登陆：<br/>");
		out.println("<a href=\"index.jsp\">重新登陆</a>");
		return ;
	}
	String id=request.getParameter("id");
	String userid=(String) session.getAttribute("userid");
	
	Class.forName("com.mysql.jdbc.Driver");
	Connection con=DriverManager.getConnection((String) application.getAttribute("dburl"),(String) application.getAttribute("username"),(String) application.getAttribute("password"));
	Statement sm=con.createStatement();
	String sqls1="SELECT * FROM data WHERE id="+id;
	ResultSet rs=sm.executeQuery(sqls1);
	if(rs==null){
		out.println("内部错误-0003：无法查询到相应数据库信息！请联系QQ2276768747解决。");
		return ;
	}
	rs.next();
	ul.id=rs.getInt(1);
	ul.userid=rs.getInt(2);
	ul.name=rs.getString(3);
	ul.datetime=rs.getString(4);
	ul.detail=rs.getString(5);
	ul.hidden=rs.getBoolean(6);
	ul.count=rs.getInt(7);
	ul.file=rs.getString(8);
	session.setAttribute("id", id);
%>
</head>
<body>
<center>
<h1><font color="red">银光字幕组专属云服务后台管理系统-编辑资源</font></h1>
当前账户：<%=session.getAttribute("username") %>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="logout.jsp">安全注销</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="main.jsp">返回主页</a><br/>
<form action="editdata.jsp" method="post">
<table border="1">
	<tr>
		<td>资源编号：</td>
		<td><%=id %></td>
	</tr>
	<tr>
		<td>上传者编号：</td>
		<td><%=userid %></td>
	</tr>
	<tr>
		<td>标题：</td>
		<td><input type="text" id="caption" name="caption" value=<%=ul.name %> style ="width:500px;" /></td>
	</tr>
	<tr>
		<td>上传时间：</td>
		<td><%=ul.datetime %></td>
	</tr>
	<tr>
		<td>简介：</td>
		<td><textarea id="detail" name="detail" style="width:500px; height:200"><%=ul.detail %></textarea></td>
	</tr>
	<tr>
		<td>是否隐藏：<br/>（true为隐藏，<br/>false为不隐藏）</td>
		<td><input type="text" id="hidden" name="hidden" value=<%=ul.hidden %> style ="width:500px;" /></td>
	</tr>
	<tr>
		<td>访问次数：</td>
		<td><%=ul.count %></td>
	</tr>
	<tr>
		<td>文件名：</td>
		<td><%=ul.file %></td>
	</tr>
	<tr>
		<td><input type="submit" value="提交" /></td>
		<td><a href="main.jsp">不提交</a></td>
	</tr>
</table>
</form>
</center>
</body>
</html>